package com.zhhs.jzcd.channel.service.impl;

import java.util.List;
import com.zhhs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhhs.jzcd.channel.mapper.BaseChannelMapper;
import com.zhhs.jzcd.channel.domain.BaseChannel;
import com.zhhs.jzcd.channel.service.IBaseChannelService;

/**
 * 渠道Service业务层处理
 *
 * @author ruoyi
 * @date 2023-08-03
 */
@Service
public class BaseChannelServiceImpl implements IBaseChannelService
{
    @Autowired
    private BaseChannelMapper baseChannelMapper;

    /**
     * 查询渠道
     *
     * @param id 渠道主键
     * @return 渠道
     */
    @Override
    public BaseChannel selectBaseChannelById(Long id)
    {
        return baseChannelMapper.selectBaseChannelById(id);
    }

    /**
     * 查询渠道列表
     *
     * @param baseChannel 渠道
     * @return 渠道
     */
    @Override
    public List<BaseChannel> selectBaseChannelList(BaseChannel baseChannel)
    {
        return baseChannelMapper.selectBaseChannelList(baseChannel);
    }

    /**
     * 新增渠道
     *
     * @param baseChannel 渠道
     * @return 结果
     */
    @Override
    public int insertBaseChannel(BaseChannel baseChannel)
    {
        baseChannel.setCreateTime(DateUtils.getNowDate());
        return baseChannelMapper.insertBaseChannel(baseChannel);
    }

    /**
     * 修改渠道
     *
     * @param baseChannel 渠道
     * @return 结果
     */
    @Override
    public int updateBaseChannel(BaseChannel baseChannel)
    {
        baseChannel.setUpdateTime(DateUtils.getNowDate());
        return baseChannelMapper.updateBaseChannel(baseChannel);
    }

    /**
     * 批量删除渠道
     *
     * @param ids 需要删除的渠道主键
     * @return 结果
     */
    @Override
    public int deleteBaseChannelByIds(Long[] ids)
    {
        return baseChannelMapper.deleteBaseChannelByIds(ids);
    }

    /**
     * 删除渠道信息
     *
     * @param id 渠道主键
     * @return 结果
     */
    @Override
    public int deleteBaseChannelById(Long id)
    {
        return baseChannelMapper.deleteBaseChannelById(id);
    }

    /**
     * 修改渠道状态
     * @param id 渠道主键
     * @param channelStatus 渠道状态码
     * @return 结果
     */
    public int changeStatus(Long id, String channelStatus){
        return baseChannelMapper.changeStatus(id,channelStatus);
    }

}
